import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *


testCase="DBshop011_管理商品添加商品"
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,"商品管理","管理商品")
firefox.find_element_by_partial_link_text("添加商品").click()
goods_name="苹果XR"
firefox.find_element_by_id("goods_name").send_keys("苹果XR")
firefox.find_element_by_id("goods_shop_price").send_keys("7999")
firefox.find_element_by_xpath("//select[@id='goods_type']/option[3]").click()
firefox.find_element_by_xpath("//button").click()
print(firefox.find_element_by_xpath("//table/tbody/tr[2]/td[3]").text)

try:
     if firefox.find_element_by_xpath("//table/tbody/tr[2]/td[3]").text==goods_name:
        writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
